package com.kkb.controller;

import com.kkb.pojo.Team;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("res")
public class ResultController {

    @ResponseBody // 表示变为了响应体
    @RequestMapping("test04")
    private Team test04(){
        Team team = new Team(1005,"EDG");
        return team;
    }


    @ResponseBody // 表示变为了响应体
    @RequestMapping("test03")
    private String test03(){
        return "jsp/result";
    }

    @RequestMapping("test02")
    private String test02(HttpServletRequest request){
        Team team = new Team(100,"阿巴战队");
        request.setAttribute("team",team);
        return "jsp/result";
    }

    @RequestMapping("test01")
    private ModelAndView test01(){
        ModelAndView mv = new ModelAndView();
        mv.addObject("name","阿柴");
        mv.setViewName("jsp/result");
        return mv;

    }
}
